{load header}
<!--/H-->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
                        <!-- nav -->
            

            
	<div class="main-title">
		<h2>文章管理</h2>
	</div>
	<div class="cf">
                【
		<a {if $Status == 0}class="btn"{/if}  href="{eval echo site_url('community/index')}">全部</a> 
		<a {if $Status == 1}class="btn"{/if} href="{eval echo site_url('community/index')}?status=1">等待审核</a> 
		<a {if $Status == 2}class="btn"{/if} href="{eval echo site_url('community/index')}?status=2">审核通过</a> 
		<a {if $Status == 3}class="btn"{/if} href="{eval echo site_url('community/index')}?status=3">审核失败</a>
		】
                
                <!--排序-->
                【
                <a {if $order_name == 'hot'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=hot&hot_order={if $hot_order_val}{$hot_order_val}{else}desc{/if}">热门</a>
                <a {if $order_name == 'recommend'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=recommend&rec_order={if $rec_order_val}{$rec_order_val}{else}desc{/if}">推荐</a>
                <a {if $order_name == 'show'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=show&show_order={if $show_order_val}{$show_order_val}{else}desc{/if}">显示</a>
                <a {if $order_name == 'sort'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=sort&sort_order={if $sort_order_val}{$sort_order_val}{else}desc{/if}">排序</a>
                <a {if $order_name == 'readnum'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=readnum&read_order={if $read_order_val}{$read_order_val}{else}desc{/if}">阅读数</a>
                <a {if $order_name == 'commentnum'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=commentnum&comment_order={if $comment_order_val}{$comment_order_val}{else}desc{/if}">评论数</a>
                <a {if $order_name == 'likes'}class="btn"{/if} href="{eval echo site_url('community/index')}?order=likes&likes_order={if $likes_order_val}{$likes_order_val}{else}desc{/if}">点赞数</a>
                】
		<!-- 高级搜索 -->
		<div class="search-form fr cf">
			<div class="sleft">
                                <div class="drop-down drop-award">
					<span id="sch-sort-txt-award" class="sort-txt" data="{if $cat}{$cat}{else}cat{/if}">{if $cate_name}{$cate_name}{else}文章栏目{/if}</span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu-award" class="nav-list hidden">
                                            <li><a href="javascript:void(0);" value="cat">文章栏目</a></li>
                                            <li><a href="javascript:void(0);" value="title">文章标题</a></li>
                                            <li><a href="javascript:void(0);" value="tag">文章标签</a></li>
                                            <li><a href="javascript:void(0);" value="name">用户名</a></li>
                                            <li><a href="javascript:void(0);" value="nick">用户昵称</a></li>
					</ul>
				</div>
				<input type="text" name="q" class="search-input" value="{$keyword}" placeholder="请输入查询关键字">
				<a class="sch-btn" href="javascript:;" id="search" url=""><i class="btn-search"></i></a>
			</div>
		</div>
	</div>
	<div class="tab-wrap">
		
		<div class="tab-content">
			
			<!-- 数据列表 -->
			<div class="data-table table-striped">
				<table>
                                    <thead>
                                        <tr>
                                            <th style="width: 50px;">顺序</th>
                                            <th style="width: 350px;">文章标题</th>
                                            <th style="width: 90px;">文章栏目</th>
                                            <th style="width: 120px;">文章作者</th>
                                            <th style="width: 75px;">作者角色</th>
                                            <th style="width: 67px;">状态</th>
                                            <th>阅读数</th>
                                            <th>评论数</th>
                                            <th>点赞数</th>
                                            <th style="width: 50px;">热门</th>
                                            <th style="width: 50px;">推荐</th>
                                            <th>显示</th>
                                            <th>发表时间</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <!--{loop $list $k1 $val}-->
                                        <tr>
                                            <td>
                                                <form action="{eval echo site_url('community/articles_sort')}" method="post">
                                                <input type="hidden" name="id" value="{$val['id']}">
                                                <input type="text" name="sort" class="text" value="{$val['sort']}" style="width:50px;">
                                                </form>
                                            </td>
                                            <td><a href="{$val['detail_url']}" target="_blank">{$val['title']}</a></td>
                                            <td>{$val['cat_name']}</td>
                                            <td><a href="{$val['space_url']}" target="_blank">{$val['nickname']}</a></td>
                                            <td>{$val['major']}</td>
                                            <td>
                                                {if $val['status'] == 0}
                                                <span>未审核</span>
                                                {elseif $val['status'] == 1}
                                                <span style="color:#2d7200;">审核通过</span>
                                                {else}
                                                <span style="color:#ff0000;">审核失败</span>
                                                {/if}
                                            </td>
                                            <td>
                                                <form action="{eval echo site_url('community/articles_readnum')}" method="post">
                                                <input type="hidden" name="id" value="{$val['id']}">
                                                <input type="text" name="readnum" class="text" value="{$val['readnum']}" style="width:50px;">
                                                </form>
                                            <td>{$val['commentnum']}</td>
                                            <td>
                                                <form action="{eval echo site_url('community/articles_likes')}" method="post">
                                                <input type="hidden" name="id" value="{$val['id']}">
                                                <input type="text" name="likes" class="text" value="{$val['likes']}" style="width:50px;">
                                                </form>
                                            </td>
                                            <td>
                                                <a title="<!--{if ($val['hot'])=='0' }-->设为热门<!--{else}-->点击取消<!--{/if}-->" href="{eval echo site_url('community/setstatus').'?id='.$val['id'].'&status='.abs(1-$val['hot']).'&type=hot'}" class="ajax-get"><!--{if ($val['hot'])=='0' }-->非热门<!--{else}--><span style="color:#ff0000">热门</span><!--{/if}--></a>
                                            </td>
                                            <td>
                                                <a title="<!--{if ($val['recommend'])=='0' }-->点击推荐<!--{else}-->点击取消<!--{/if}-->" href="{eval echo site_url('community/setstatus').'?id='.$val['id'].'&status='.abs(1-$val['recommend']).'&type=recommend'}" class="ajax-get"><!--{if ($val['recommend'])=='0' }-->非推荐<!--{else}--><span style="color:#ff0000">推荐</span><!--{/if}--></a>
                                            </td>
                                            <td>
                                                <a title="<!--{if ($val['show'])=='0' }-->点击显示<!--{else}-->点击隐藏<!--{/if}-->" href="{eval echo site_url('community/setstatus').'?id='.$val['id'].'&status='.abs(1-$val['show']).'&type=show'}" class="ajax-get"><!--{if ($val['show'])=='0' }-->隐藏<!--{else}--><span style="color:#ff0000">显示</span><!--{/if}--></a>
                                            </td>
                                            <td>{$val['create_time']}</td>
                                            <td>
                                                <a title="编辑" href="{eval echo site_url('community/articles_edit').'?id='.$val['id']}">编辑</a>
                                                <a title="查看" href="{$val['detail_url']}" target="_blank">查看</a>
                                            </td>
                                        </tr>
                                        <!--{/loop}-->
                                    </tbody>
				</table>
				<!-- 分页 -->
				<div class="page">
					<div>
					{$showpage}
					<span class="rows">共 {$Total} 条记录</span>
					</div>
				</div>
			</div>
	
		</div>
	</div>
<script>
    $(function(){
	//搜索功能
	$("#search").click(function(){
            
	var url = $(this).attr('url');
        var award = $("#sch-sort-txt-award").attr("data");
	var statusmake = $("#sch-sort-txt-make").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
                if(award != ''){
                        query += '&cate_type=' + award; //板块
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	
	$(".search-form").find(".drop-award").hover(function(){
		$("#sub-sch-menu-award").removeClass("hidden");
		
	},function(){
		$("#sub-sch-menu-award").addClass("hidden");
		
	});
        
	$("#sub-sch-menu-award li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt-award").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu-award").addClass("hidden");
		})
	});
        	
    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });
    
    /* 实时更新分类信息 */
    $(".tab-content")
            .on("submit", "form", function(){
                    var self = $(this);
                    $.post(
                            self.attr("action"),
                            self.serialize(),
                            "json"
                    );
                    return false;
            })
            .on("focus","input",function(){
                    $(this).data('param',$(this).closest("form").serialize());

                })
            .on("blur", "input", function(){
                    if($(this).data('param')!=$(this).closest("form").serialize()){
                        $(this).closest("form").submit();
                    }
                });
    
})
</script>
<!--F-->{load footer}